package com.shengzai.mapreduce.partioner;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class Student implements Writable {

    String name;
    String sID;
    int age;
    String sex;
    int score;

    public Student(String s, String s1, String s2, int parseInt) {
    }


    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Student() {
    }

    public Student(String name, String sID, String sex, int score,int age) {
        this.age=age;
        this.name = name;
        this.sID = sID;
        this.sex = sex;
        this.score = score;
    }

    public Student(String name, String sID, String sex, int score, Integer integer) {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getsID() {
        return sID;
    }

    public void setsID(String sID) {
        this.sID = sID;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    @Override
    public String toString() {
        return sID+"\t"+name+"\t"+sex+"\t"+score;
    }

    @Override
    public void write(DataOutput out) throws IOException {
        out.writeUTF(this.sID);
        out.writeUTF(this.name);
        out.writeUTF(this.sex);
        out.write(this.age);
        out.write(this.score);
    }

    @Override
    public void readFields(DataInput in) throws IOException {
        this.sID=in.readUTF();
        this.name=in.readUTF();
        this.sex=in.readUTF();
        this.age= in.readInt();
        this.score=in.readInt();
    }
}

